package com.basic.tools.codegen.entity;

import com.fasterxml.jackson.annotation.JsonFormat;

import java.io.Serializable;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;

/**
 * Entity基类
 */
public class BaseEntity implements Serializable
{
    private static final long serialVersionUID = 1L;

    /** 搜索值 */
    private String searchValue;

    /** 创建者 */
    private String createBy;

    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;

    /** 更新者 */
    private String updateBy;

    /** 更新时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date updateTime;

    /** 备注 */
    private String remark;

    /** 请求参数 */
    private Map<String, Object> params;

    public String getSearchValue()
    {
        return searchValue;
    }

    public void setSearchValue(String searchValue)
    {
        this.searchValue = searchValue;
    }

    public String getCreateBy()
    {
        return createBy;
    }

    public void setCreateBy(String createBy)
    {
        this.createBy = createBy;
    }

    public Date getCreateTime()
    {
        return createTime;
    }

    public void setCreateTime(Date createTime)
    {
        this.createTime = createTime;
    }

    public String getUpdateBy()
    {
        return updateBy;
    }

    public void setUpdateBy(String updateBy)
    {
        this.updateBy = updateBy;
    }

    public Date getUpdateTime()
    {
        return updateTime;
    }

    public void setUpdateTime(Date updateTime)
    {
        this.updateTime = updateTime;
    }

    public String getRemark()
    {
        return remark;
    }

    public void setRemark(String remark)
    {
        this.remark = remark;
    }

    public Map<String, Object> getParams()
    {
        if (params == null)
        {
            params = new HashMap<>();
        }
        return params;
    }

    public void setParams(Map<String, Object> params)
    {
        this.params = params;
    }

    /**
     * 通用常量信息
     */
    public static class Constants
    {
        /**
         * UTF-8 字符集
         */
        public static final String UTF8 = "UTF-8";

        /**
         * GBK 字符集
         */
        public static final String GBK = "GBK";

        /**
         * 通用成功标识
         */
        public static final String SUCCESS = "0";

        /**
         * 通用失败标识
         */
        public static final String FAIL = "1";

        /**
         * 登录成功
         */
        public static final String LOGIN_SUCCESS = "Success";

        /**
         * 注销
         */
        public static final String LOGOUT = "Logout";

        /**
         * 注册
         */
        public static final String REGISTER = "Register";

        /**
         * 登录失败
         */
        public static final String LOGIN_FAIL = "Error";

        /**
         * 当前记录起始索引
         */
        public static final String PAGE_NUM = "pageNum";

        /**
         * 每页显示记录数
         */
        public static final String PAGE_SIZE = "pageSize";

        /**
         * 排序列
         */
        public static final String ORDER_BY_COLUMN = "orderByColumn";

        /**
         * 排序的方向 "desc" 或者 "asc".
         */
        public static final String IS_ASC = "isAsc";

        /**
         * 系统用户授权缓存
         */
        public static final String SYS_AUTH_CACHE = "sys-authCache";

        /**
         * 参数管理 cache name
         */
        public static final String SYS_CONFIG_CACHE = "sys-config";

        /**
         * 参数管理 cache key
         */
        public static final String SYS_CONFIG_KEY = "sys_config:";

        /**
         * 字典管理 cache name
         */
        public static final String SYS_DICT_CACHE = "sys-dict";

        /**
         * 字典管理 cache key
         */
        public static final String SYS_DICT_KEY = "sys_dict:";

        /**
         * 资源映射路径 前缀
         */
        public static final String RESOURCE_PREFIX = "/profile";
    }
}
